package com.example.javatest.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.javatest.entity.domain.TbClass;
import com.example.javatest.entity.domain.TbUser;
import com.example.javatest.service.TbClassService;
import com.example.javatest.mapper.TbClassMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author cac_qin
* @description 针对表【tb_class】的数据库操作Service实现
* @createDate 2023-12-13 21:39:11
*/
@Service
public class TbClassServiceImpl extends ServiceImpl<TbClassMapper, TbClass>
    implements TbClassService{
    @Resource
    private TbClassMapper tbClassMapper;

    @Override
    public TbClass getClass(int classId) {

        //查询班级是否存在
        QueryWrapper<TbClass> queryWrapper =new QueryWrapper<>();
        queryWrapper.eq("class_Id",classId);
        int count = tbClassMapper.selectCount(queryWrapper);
        if(count<0){
            return null;
        }

        TbClass tbClass =tbClassMapper.selectById(classId);
        return tbClass;
    }
}




